﻿#region Header
// ------------------------ Licence / Copyright ------------------------
// 
// ScrumTable for Scrum Meeting Support
// Copyright © HSR - Hochschule für Technik Rapperswil
// All Rights Reserved
// 
// Author:
//  Michael Gfeller Silvan Gehrig Patrick Boos
// 
// ---------------------------------------------------------------------
#endregion

#region Usings

using System;
using System.Collections.Generic;

#endregion

namespace ScrumTable.DL.Data.Generic.Cache
{
    /// <summary>
    /// Represents a tracked dictionary value entry.
    /// </summary>
    public interface ICacheTrackedDictionaryBucket : ICacheTrackedElement
    {
        #region Properties
        //--------------------------------------------------------------------
        // Properties
        //--------------------------------------------------------------------

        /// <summary>
        /// Gets the current bucket value.
        /// </summary>
        object Value { get; set; }

        /// <summary>
        /// Gets the original bucket value.
        /// </summary>
        object OriginalValue { get; set; }

        /// <summary>
        /// Gets the last valid value stored on the server side. This field is
        /// required for settings because it's needed to check whether the
        /// settings contains an actual (not a user changed) value.
        /// </summary>
        object LastBackEndValue { get; set; }

        /// <summary>
        /// Gets the revision of the Value property.
        /// </summary>
        double CacheRevision { get; }

        /// <summary>
        /// Returns true if the current bucket contains a value. This means
        /// that the value has been set once at least.
        /// </summary>
        bool HasValue
        {
            get;
        }

        #endregion

        #region Methods
        //--------------------------------------------------------------------
        // Methods
        //--------------------------------------------------------------------

        /// <summary>
        /// Creates a new object that is a copy of the current instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this instance.
        /// </returns>
        new ICacheTrackedDictionaryBucket Clone();

        #endregion

        #region Events
        //--------------------------------------------------------------------
        // Events
        //--------------------------------------------------------------------

        /// <summary>
        /// Fires an event which signals after the value property changes.
        /// </summary>
        event EventHandler ValueChanged;

        /// <summary>
        /// Fires an event which signals before the value property changes.
        /// </summary>
        event EventHandler ValueChanging;

        #endregion
    }
}